<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingRoomEmploy"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingRoomMain"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingRoomFileUpload"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	MeetingRoomEmploy infos =(MeetingRoomEmploy)session.getAttribute("roomEmpoly");
	List roomList=(List)request.getAttribute("roomList");
	String strName=(String)request.getAttribute("strName");
	SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
	String treePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/Tree/";
	ArrayList<MeetingRoomFileUpload> fileList=(ArrayList<MeetingRoomFileUpload>)request.getAttribute("fileList");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<base href="<%=basePath%>" />
	<title>天津市粮油集团有限公司</title>
	<style type="text/css">
		.daohang {
		    background-image: url(<%=basePath%>images/ju.gif) !important;
		}
		td {
			font:12px/170% "宋体", "新宋体", "黑体"; color:#000
		}
		th {
			font:12px/170% "宋体", "新宋体", "黑体"; color:#000
		}
		.black_overlays{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 1200px;
			height: 800px;
			background-color: gray;
			z-index:1001;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=80);
		}

		/* 添加任务div样式 */
		.ceshi5 {
		    display: none;
			position: absolute;
			top: 25%;
			left: 30%;
			width: 253px;
			height: 235px;
			border: 1px solid #11557B;
			border-bottom: block;
			background-color: #E2F7FF;
			z-index: 1003;
			overflow: auto;
		}
  </style>
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" />
	<!-- 多系统树 开始 -->
	<link href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=treePath %>ajaxFramework/ext-2.1/adapter/ext/ext-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/global/validator.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/global/pageControl.js"></script>
	
	<script type="text/javascript" src="<%=basePath %>js/common/system/selectusertreecheck.js"></script>
	<!-- 结束 -->	
	
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
	
	<!-- 执行上传文件操作的函数 start-->
	<script type="text/javascript" src="<%=basePath %>js/common/fileUpload/ajaxfileupload.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/fileUpload/ajaxFileZx.js"></script>
	<script type="text/javascript">
	var deleteFile;
	var alreadyUploadFile='';
	var uploadUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=uploader';
	var deteleFileUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=deleted';
	</script>
	<!-- 执行上传文件操作的函数 end-->
	<script type="text/javascript">
	function checkAllTextValid(form)  
	{  
	    //记录不含引号的文本框数量  
		var resultTag = 0;  
		//记录所有text文本框数量  
		var flag = 0;  
		for(var i = 0; i < form.elements.length; i ++)  
		{  
		 if(form.elements[i].type=="text")  
		 {  
		     flag = flag + 1;  
		  //此处填写所要过滤的特殊符号  
		  //注意：修改####处的字符，其它部分不许修改.  
		  //if(/^[^####]*$/.test(form.elements[i].value))  
		  if(/^[^\|"'<>]*$/.test(form.elements[i].value)) resultTag = resultTag+1;  
		  else form.elements[i].select();  
		 }  
		}
		//如果含引号的文本框等于全部文本框的值，则校验通过  
		if(resultTag == flag) return true;  
		else 
		{  
		 Ext.MessageBox.alert('提示框',"<nobr>文本框中不能含有<br/> 1 单引号: ' <br/> 2 双引号: \" <br/> 3 竖  杠: | <br/> 4 尖角号: < > <br/><br/>请检查输入！</nobr>");  
		 return false;  
		}  
	} 
		
	function submitpages(value){
		if(value==-1){
		    Ext.MessageBox.alert('提示框','<nobr>请重新选择会议室</nobr>');
			return false;
		}
	}
	// 判断不能为空
	function submitform1(){
		if(document.form1.meetingName.value == null || document.form1.meetingName.value == ''){
			Ext.MessageBox.alert('提示框','<nobr>请填入会议名称</nobr>');
		}
		else if(document.form1.meetingName.value.length>20){
		    Ext.MessageBox.alert('提示框','<nobr>会议名称不能超过20个汉字</nobr>');
		}
		else if(document.form1.selectPage.value == 0 || document.form1.selectPage.value == ''){
		    Ext.MessageBox.alert('提示框','<nobr>请选择会议室</nobr>');
		}
		else if(document.form1.time.value == ''){
		    Ext.MessageBox.alert('提示框','<nobr>请填入会议开会日期</nobr>');
		}
		else if(document.form1.starttime.value == ''){
		    Ext.MessageBox.alert('提示框','<nobr>请填入会议开始时间</nobr>');
		}
		else if(document.form1.meetingPeopleId.value == ''  ){
		    Ext.MessageBox.alert('提示框','<nobr>参会人不能为空</nobr>');
		}
		else{
			if(document.getElementById('uploadFile').value!= ''){
				Ext.Msg.confirm('系统提示','您有未上传的文件，是否上传？',function(btn){
					if(btn=='yes'){
						ajaxFileUpload();
					}else{
						if(checkAllTextValid(document.form1))document.form1.submit();
					}
				},this);
			}else{
				if(checkAllTextValid(document.form1))document.form1.submit();
			}
		}
	}
	
	function bianhua(){
		var start = document.form1.starttime.value;
		if(start!=null){
			if(start.split(':')[0].substring(0,1)=='1' && parseInt(start.split(':')[0].substring(1,2))>2){
				document.form1.remarks.value = '下午';
			}else{
				document.form1.remarks.value = '上午';
			}
		}
	}
	
	function shanchu(_uuid){
		Ext.Msg.confirm('系统提示','是否删除此文件？',function(btn){
			if(btn=='yes'){
				var ele = document.getElementById(_uuid);
				ele.style.display ='none';
				document.getElementById('deleteFile').value += "'"+_uuid+"',";
			}
		},this);
	}
	
	function back()
	{
		history.back(-1);
	}
	window.onload = function(){
		initselectusertreecheck();
		document.getElementById("right").style.height = document.body.clientHeight-15;
		document.getElementById("tableid").style.height = document.body.clientHeight-40;
		var tb = new Ext.Toolbar(
			{
				height:25
			}
		);
		tb.render('menu');
		tb.add(
	    {
	            text:'确定',
	            iconCls: 'daohang',
	        	handler: function(){
	        		submitform1();
				}
	    },
	    {
	            text:'返回',
	            iconCls: 'daohang',
	        	handler: function(){
	        		back();
				}
	    }
	    );
		tb.addFill();
	    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">修改安排会议</a>&nbsp;&nbsp;&nbsp;');
	}
    </script>
	</head>
	<body>
	<form action="<%=basePath%>tjsinfo/tjsoa/meetingroom/againUpdateArrangements.do" method="post" name="form1">
		<input type="hidden" name="roomEmpoly" id="roomEmpoly" value="<%=infos.getId() %>"/>
		<input type="hidden" name="node2" id="node2"/>
		<input type="hidden" name="node" id="node"/>
		<input id="basePath" value="<%=basePath%>" type="hidden"/>
		<input type="hidden" name="deleteFile" id="deleteFile" value=""/>
		<div id="files" style="display: none;"></div>
		<div id="right" style="overflow-y: scroll;overflow-x: hidden">
		<div id="menu" style="padding-top:4px;"></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tableid">
          <tr>
            <td valign="top" height="100%">
               <div class="contabwd">
               		<table width="100%" height="400"border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="90%">
                            	<table border="0" cellspacing="0" cellpadding="0" align="left" style="margin-top:10px; margin-left:20px">
                                  <tr>
                                    <td>
                                            <table border="0" align="left" cellpadding="0" cellspacing="0" class="ttaabb">
                                              <tr>
                                                <td width="25%" align="right"><img src="images/dfdf_03.gif" />&nbsp;会议名称:</td>
                                                <td width="65%"><input name="meetingName" value="<%=infos.getMeetingName() %>" type="text" size="41" style="border:1px #C0C0C0 solid;background:#F4F4F4; height:19px"/></td>
                                                <td width="10%">&nbsp;</td>
                                              </tr>
                                              <tr>
                                              <td width="25%" align="right"><img src="images/dfdf_03.gif" />&nbsp;请选择会议室:</td>
                                              <td>
                                              	<select name="selectPage" id="selectPage">
													<option value="<%=infos.getMeetingRoomMain().getId() %>">
														<%=infos.getMeetingRoomMain().getMeetingroomName() %>
													</option>
													<%
														for (Iterator iterator = roomList.iterator(); iterator.hasNext();) {
															MeetingRoomMain mrm = (MeetingRoomMain) iterator.next();
															if(infos.getMeetingRoomMain().getId().equals(mrm.getId())){
																continue;
															}
													%>
													<option value="<%=mrm.getId() %>"><%=mrm.getMeetingroomName() %></option>
													<%
														}
													%>
												</select>
												</td>
                                              </tr>
                                              <tr>
                                                <td align="right"><img src="images/dfdf_03.gif" />&nbsp;开会日期:</td>
                                                <td>
                                                <input type="text" id="time" name="time" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate" value="<%=infos.getMeetingTime() %>"/>
                                                </td>
                                                <td>&nbsp;</td>
                                              </tr>
                                              <tr>
                                                <td align="right"><img src="images/dfdf_03.gif" />&nbsp;开始时间:</td>
                                                <td>
                                                <input type="text" id="starttime" name="starttime" onfocus="WdatePicker({dateFmt:'HH:mm'})" class="Wdate" value="<%=sdf.format(infos.getStartTime()) %>" onchange="bianhua();"/>
                                                </td>
                                                <td>&nbsp;</td>
                                              </tr>
												<tr>
													<td align="right">
														<img src="images/dfdf_03.gif" />
														&nbsp;持续时间:
													</td>
													<td>
														<select id="endtime" name="endtime">
															<option value="1" <%if("1".equals(infos.getEndTime()))out.print("selected"); %>>1</option>
															<option value="2" <%if("2".equals(infos.getEndTime()))out.print("selected"); %>>2</option>
															<option value="3" <%if("3".equals(infos.getEndTime()))out.print("selected"); %>>3</option>
															<option value="4" <%if("4".equals(infos.getEndTime()))out.print("selected"); %>>4</option>
															<option value="5" <%if("5".equals(infos.getEndTime()))out.print("selected"); %>>5</option>
															<option value="6" <%if("6".equals(infos.getEndTime()))out.print("selected"); %>>6</option>
															<option value="7" <%if("7".equals(infos.getEndTime()))out.print("selected"); %>>7</option>
															<option value="8" <%if("8".equals(infos.getEndTime()))out.print("selected"); %>>8</option>
															<option value="9" <%if("9".equals(infos.getEndTime()))out.print("selected"); %>>9</option>
															<option value="10" <%if("10".equals(infos.getEndTime()))out.print("selected"); %>>10</option>
														</select>小时
													</td>
													<td>
														&nbsp;
													</td>
												</tr>
												<tr>
													<td align="right">
														<img src="images/dfdf_03.gif" />
														&nbsp;会议时间段:
													</td>
													<td>
														<select id="remarks" name="remarks">
															<option value="上午" <%if("上午".equals(infos.getRemarks()))out.print("selected"); %>>上午</option>
															<option value="下午" <%if("下午".equals(infos.getRemarks()))out.print("selected"); %>>下午</option>
															<option value="全天" <%if("全天".equals(infos.getRemarks()))out.print("selected"); %>>全天</option>
														</select>
													</td>
													<td>
														&nbsp;
													</td>
												</tr>
											<%//申请的
											if("1".equals(infos.getMeetingId())){
											%>
                                              <tr>
                                              	<td align="right">
                                              		<img src="images/dfdf_03.gif" />
                                              		&nbsp;参会人:
												</td>
												<td>
													<input type="text" name="meetingPeopleName" id="meetingPeopleName" size="80" style="border: 1px #C0C0C0 solid; background: #F4F4F4; height: 19px" value="<%=strName %>"/>
													<a href="javascript:selectusertreecheckwinshow('meetingPeopleId','meetingPeopleName','node')">
													<img src="images/icon100.gif" />
													</a>
                                                	<input type="hidden" name="meetingPeopleId" id="meetingPeopleId" value="<%=infos.getPeopleId() %>"/>
												</td>
												<td>
												</td>
											</tr>
                                             <%}else{ %>
                                              <tr>
                                                <td align="right"><img src="images/dfdf_03.gif" />&nbsp;领导及部门:</td>
                                                <td><input name="meetingPeopleId" id="meetingPeopleId" type="text" size="95" style="border:1px #C0C0C0 solid;background:#F4F4F4; height:19px" value="<%=infos.getPeopleId() %>"/></td>
                                                <td>&nbsp;						
												</td>
                                              </tr>
                                             <%} %>
                                              <tr>
                                                <td align="right"><img src="images/dfdf_03.gif" />&nbsp;内容及特殊需要:</td>
                                                <td><textarea name="content" cols="69" rows="10"><%=infos.getMeetingContent() %></textarea></td>
                                                <td>&nbsp;</td>
                                              </tr>
												<%
												if(fileList!=null && fileList.size()>0){
												%>
												<tr>
													<td align="right">
														<img src="images/dfdf_03.gif" />
														&nbsp;现有文件:
													</td>
													<td>
														<table width="400px" border="0" cellspacing="0">
														<%
															for (Iterator iterator = fileList.iterator(); iterator.hasNext();) {
																MeetingRoomFileUpload file = (MeetingRoomFileUpload) iterator.next();
														%>
														<tr id="<%=file.getUuid() %>">
															<td width="400px" cellpadding="0" cellspacing="0" class="ttaabb" style="font-weight:normal">
															<a href="<%=basePath %>tjsinfo/tjsoa/meetingroom/ioAction.do?id=<%=file.getUuid()%>"><%=file.getOldFileName()%></a>&nbsp;&nbsp;&nbsp;
															&nbsp;&nbsp;&nbsp;<a href="javascript:shanchu('<%=file.getUuid() %>');">删除</a>
															</td>
														</tr>
														<%
														}
														%>
														</table>
													</td>

												</tr>
												<%	
												}
												%>
												<tr>
													<td>
														<img src="<%=basePath %>images/m_icon212.gif" width="67" height="21" />
													</td>
													<td>
			                							<span><input type="file" UNSELECTABLE="on"  name="uploadFile" id="uploadFile" size="34" class="textinput" />&nbsp;<a style="cursor: hand" onclick="ajaxFileUpload()"><img src="<%=basePath %>images/scicon.gif" /></a></span>
			                							<div class="sc_listLong"><ul id="uploadList"></ul></div>
													</td>
													<td>
													</td>
												</tr>
                                              <tr>
                                                <th colspan="3">&nbsp;</th>
                                              </tr>
                                            </table>
                                    </td>
                                  </tr>
                                </table>
                            </td>
                          </tr>
                     </table>
              </div>
            </td>
          </tr>
      </table>
		</div>
		</form>
</html>
